<%-- 
    Document   : viewBills
    Created on : Apr 10, 2011, 9:39:30 PM
    Author     : Nguyen Hung
--%>

<%@page import="java.text.NumberFormat"%>
<%@page import="java.util.Date"%>
<%@page import="Business.Order"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>


<%@include file="../WEB-INF/jspf/headeradmin.jspf" %>
        <style type="text/css" title="currentStyle">
            @import "datatable/demo_page.css";
            @import "datatable/demo_table_jui.css";
            @import "datatable/jquery-ui-1.8.4.custom.css";
        </style>
        <script type="text/javascript" language="javascript" src="datatable/jquery.js"></script>
        <script type="text/javascript" language="javascript" src="datatable/jquery.dataTables.js"></script>
        <script type="text/javascript" charset="utf-8">
            $(document).ready(function() {
                oTable = $('#orderTable').dataTable({
                    "bJQueryUI": true,
                    "sPaginationType": "full_numbers"
                });
            } );
        </script>

   
     
        <table id="orderTable" class="display">
            <thead>
            <th>STT </th>
            <th>Mã Hóa Đon</th>
            <th>Tên Khách Hàng</th>
            <th>Ngày Đặt Hàng </th>
            <th>Thành Tiền</th>

        </thead>
        <tbody>

            <%

                        ArrayList<Order> orders = (ArrayList<Order>) session.getAttribute("orders");

                        NumberFormat nf = NumberFormat.getInstance();
            //nf.setMinimumFractionDigits(2);
            nf.setMaximumFractionDigits(2);

                        for (int i = 0; i < orders.size(); i++) {
                            Order order = orders.get(i);
                            String name = order.getCustomer().getName();
                            Date date = order.getDate();
            %>
            <tr class="gradeU">
                <td><%=i%></td>
                <td><a href="ViewOrderDetail?stt=<%=i%>"><%=order.getIdOrder()%></a></td>
                <td><%=name%></td>
                <td><%=date.getDate() + "/" + date.getMonth() + "/" + date.getYear()%></td>
                <td><%=nf.format(order.getTotal())%></td>

            </tr>
            <%

                        }
            %>
        </tbody>

    </table>
    
<%@include file="../WEB-INF/jspf/footeradmin.jspf" %>